
#include <QLocale>
#include <QObject>
#include <QTranslator>

#include <QtDeclarative>

#include <bb/cascades/Application>

#include <org/puzzlehead/bbcache/BBCache.hpp>
#include <org/puzzlehead/bbcache/NearbyCaches.h>

using namespace bb::cascades;
using namespace org::puzzlehead::bbcache;

void registerTypes(void)
{
	const char * package = "org.puzzlehead.bbcache";
	int majorVersion = 1;
	int minorVersion = 0;

	qmlRegisterType<NearbyCaches>(package, majorVersion, minorVersion, "NearbyCaches");
}

Q_DECL_EXPORT int main(int argc, char **argv)
{
    // this is where the server is started etc
    Application app(argc, argv);

    // localization support
    QTranslator translator;
    QString locale_string = QLocale().name();
    QString filename = QString( "BBCache_%1" ).arg( locale_string );
    if (translator.load(filename, "app/native/qm")) {
        app.installTranslator( &translator );
    }

    // create the application pane object to init UI etc.
    new BBCache(&app);

    // we complete the transaction started in the app constructor and start the client event loop here
    return Application::exec();
    // when loop is exited the Application deletes the scene which deletes all its children (per qt rules for children)
}
